function [test_patterns, test_targets, train_patterns, train_targets] = stratifiedHoldout(patterns, targets)

patterns_1 = patterns(:,find(targets==0));
patterns_2 = patterns(:,find(targets==1));

%Stratification
[train_indices_1, test_indices_1] = make_a_draw(floor(30/100*150), 150);
train_patterns_1 = patterns_1(:, train_indices_1);    
train_targets_1  = zeros (1, length(train_indices_1));    
test_patterns_1  = patterns_1(:, test_indices_1);     
test_targets_1   = zeros (1, length(test_indices_1)); 

[train_indices_2, test_indices_2] = make_a_draw(floor(30/100*150), 150);
train_patterns_2 = patterns_2(:, train_indices_2);    
train_targets_2  = ones (1, length(train_indices_2));    
test_patterns_2  = patterns_2(:, test_indices_2);     
test_targets_2   = ones (1, length(test_indices_2)); 

%Result
test_patterns = cat(2,test_patterns_1,test_patterns_2);
test_targets = cat(2, test_targets_1, test_targets_2);

train_patterns = cat(2,train_patterns_1,train_patterns_2);
train_targets = cat(2, train_targets_1, train_targets_2);

%Shuffle
test_permutation = randperm(length(test_targets));
test_patterns = test_patterns(:,test_permutation);
test_targets = test_targets(test_permutation);

train_permutation = randperm(length(train_targets));
train_patterns = train_patterns(:,train_permutation);
train_targets = train_targets(train_permutation);


end